﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VINETLIFE.BL;
using VINETLIFE.DO;
using System.Data;

namespace VINETLIFE.AdminCP
{
    public partial class ListOrderStatus : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                grvArtDataSource(new cmsTransactionStatusBL().SelectAll());
            }
        }
        protected void grvArtDataSource(DataTable dt)
        {
            gvAt.DataSource = dt;
            gvAt.DataBind();
        }


        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Response.Redirect("OrderStatus.aspx");
        }



        protected void gvAt_SelectedIndexChanged(object sender, EventArgs e)
        {
            int TransactionStatusId = int.Parse(gvAt.DataKeys[gvAt.SelectedIndex].Value.ToString());
            Response.Redirect("OrderStatus.aspx?TransactionStatusId=" + TransactionStatusId.ToString());
        }

        protected void gvAt_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            new cmsTransactionStatusBL().Delete(new cmsTransactionStatusDO { TransactionStatusId = Convert.ToInt32(gvAt.DataKeys[e.RowIndex].Value) });
            Functions.Alert("Xóa bản tin thành công!", Request.Url.ToString());
        }



        protected void gvAt_PageIndexChanged(object sender, EventArgs e)
        {

        }

        protected void gvAt_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {

        }

    }
}